$(function(){
    $("#main_west_tree").tree({
        url:'/static/data/menu.json',
        onDblClick:function(node){
            var tree = $("#main_west_tree");
            var tabs = $("#main_center_tab");
            var isLeaf = tree.tree("isLeaf",node.target);
            if(isLeaf){
                console.log(node.attributes.url);
                var exists = tabs.tabs("exists",node.text);
                if(exists){
                    tabs.tabs("select",node.text)
                }else {
                    tabs.tabs("add",{
                        title:node.text,
                        closable:true,
                        content:'<iframe src="'+node.attributes.url+'" style="width: 100%;height: 100%" frameborder="0"></iframe>'
                    })
                }
            }else {
                tree.tree("toggle",node.target)
            }
        }
    });
    $("#main_center_tab").tabs({
        fit:true,
        pill:true,
        border:false
    });
    // $("#index_page").css("background-image","url:(static/images/background.jpg)");
    // $("#index_page").css(background-image);
});
